//
//  SJAnimatingRequestAccessory.m
//  WSL
//
//  Created by CJ on 2017/10/22.
//  Copyright © 2017年 sanjuetech. All rights reserved.
//

#import "SJAnimatingRequestAccessory.h"

@implementation SJAnimatingRequestAccessory

- (id)initWithAnimatingText:(NSString *)animatingText {
    self = [super init];
    if (self) {
        _animatingText = animatingText?animatingText:@"加载中...";
    }
    return self;
}

+ (id)accessoryWithAnimatingText:(NSString *)animatingText {
    return [[self alloc] initWithAnimatingText:animatingText];
}

- (void)requestWillStart:(id)request {
    
    dispatch_async(dispatch_get_main_queue(), ^{
        // TODO: show loading
        [SVProgressHUD showWithStatus:_animatingText];
    });
}

- (void)requestWillStop:(id)request {
    
//    dispatch_async(dispatch_get_main_queue(), ^{
//        // TODO: hide loading
//        [SVProgressHUD dismiss];
//    });
}

- (void)requestDidStop:(id)request {
    
    dispatch_async(dispatch_get_main_queue(), ^{
        // TODO: hide loading
        [SVProgressHUD dismiss];
    });
}

@end
